package com.ruoyi.warehouse.service.impl;

import com.ruoyi.warehouse.domain.WareHouseTank;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.warehouse.mapper.WareHouseFishMapper;
import com.ruoyi.warehouse.domain.WareHouseFish;
import com.ruoyi.warehouse.service.IWareHouseFishService;

import java.util.List;

/**
 * 仓库中心=》观赏鱼Service业务层处理
 *
 * @author 杨彬鑫
 * @date 2021-01-29
 */
@Service
public class WareHouseFishServiceImpl extends ServiceImpl<WareHouseFishMapper, WareHouseFish> implements IWareHouseFishService {

    @Override
    public List<WareHouseFish> queryList(WareHouseFish wareHouseFish) {
        LambdaQueryWrapper<WareHouseFish> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(wareHouseFish.getFishname())){
            lqw.like(WareHouseFish::getFishname ,wareHouseFish.getFishname());
        }
        if (StringUtils.isNotBlank(wareHouseFish.getFishtype())){
            lqw.eq(WareHouseFish::getFishtype ,wareHouseFish.getFishtype());
        }
        if (wareHouseFish.getFishGainDates() != null){
            lqw.ge(WareHouseFish::getGaindate,wareHouseFish.getFishGainDates()[0]);
            lqw.le(WareHouseFish::getGaindate,wareHouseFish.getFishGainDates()[1]);
        }
        if (StringUtils.isNotBlank(wareHouseFish.getGainmethod())){
            lqw.eq(WareHouseFish::getGainmethod ,wareHouseFish.getGainmethod());
        }
        return this.list(lqw);
    }
}
